package cn.butcher.controller;

import cn.butcher.mapper.AdminMapper;
import cn.butcher.vo.StudentLeaveMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class AdminController {

    @Autowired
    AdminMapper mapper;

    @RequestMapping("/leave/dataAll")
    public String getList(String keyword, Model model) {
        // 三元运算符  条件 ？true执行：false不执行
        List<StudentLeaveMsg> list = mapper.getList(keyword == null ? keyword : "%" + keyword + "%");

        model.addAttribute("list", list);
        return "page/leave-data-all";
    }
}
